import { Button } from 'antd';
import styles from './index.less';

interface columnsProps {
  handleEdit: (record: any) => void;
}

const columns = ({ handleEdit }: columnsProps) => {
  return [
    {
      title: '分类名称',
      dataIndex: 'name',
    },
    {
      title: '操作',
      dataIndex: 'action',
      align: 'center',
      render: (_text: any, record: any) =>
        record.pid === 0 ? (
          <span>操作</span>
        ) : (
          <span className={styles.editbtn} onClick={() => handleEdit(record)}>
            编辑
          </span>
        ),
    },
  ];
};

export default columns;
